//
//  DRFriendsFoodCell.m
//  DoctorRen
//
//  Created by 范伟健 on 2019/1/18.
//

#import "DRFriendsFoodCell.h"
#import "DRFoodPairingModel.h"

@interface DRFriendsFoodCell()
@property (weak, nonatomic) IBOutlet UIImageView *foodIV;

@property (weak, nonatomic) IBOutlet UILabel *foodName;

@property (weak, nonatomic) IBOutlet UILabel *quantityLabel;
@property (weak, nonatomic) IBOutlet UILabel *calorieLabel;

@end

@implementation DRFriendsFoodCell

+(instancetype)loadCell{
    return [[[NSBundle mainBundle] loadNibNamed:@"DRFriendsFoodCell" owner:nil options:nil] lastObject];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.foodIV.layer.cornerRadius = 4;
    self.foodIV.layer.masksToBounds = YES;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setFoodData:(DRFoodMode *)data{
    [self.foodIV setImageWithURLString:data.path];
    self.foodName.text = data.title;
    self.calorieLabel.text = data.energy;
    self.quantityLabel.text = [NSString stringWithFormat:@"%@ (%@)",data.num,data.unit];
}

@end
